package com.lbb.utils

import android.app.Activity
import android.content.res.TypedArray
import androidx.annotation.AttrRes

object ThemeUtil {

    fun getColor(activity: Activity, @AttrRes id: Int): Int {
        val attrs = intArrayOf(id)
        val typedArray: TypedArray = activity.obtainStyledAttributes(attrs)
        val color = typedArray.getColor(0, -1)
        typedArray.recycle()
        return color
    }

    fun getBoolean(activity: Activity, @AttrRes id: Int): Boolean {
        val attrs = intArrayOf(id)
        val typedArray: TypedArray = activity.obtainStyledAttributes(attrs)
        val boolean = typedArray.getBoolean(0, false)
        typedArray.recycle()
        return boolean
    }

}